#ifndef _LIBMEDIACAPTURE_H_
#define _LIBMEDIACAPTURE_H_

#ifdef LIBMEDIACAPTURE_EXPORTS
#define LIBMEDIACAPTURE_API __declspec(dllexport)
#else
#define LIBMEDIACAPTURE_API __declspec(dllimport)
#endif

#include <mutex>
#include <list>
#include <thread>
#include <string>

struct MediaSlice
{
	char* pData;
	int nLen;
};

struct MediaCaptureVideoInfo
{
	int nIndex; // 0 default
	int nFPS; // default 15
	int nWidth; // 640
	int nHeight; // 480
};

struct MediaCaptureAudioInfo
{
	int nIndex; // 0 default
	int nChannels; // 2
	int nSamplesPerSec; // 44100
	int nBitsPerSample; // must be 16
};

typedef void(*MediaCapture_CB)(int nType, char* pBuff, int nBuffLen, bool bKeyFrame);

LIBMEDIACAPTURE_API void  MediaCapture_List(std::list<std::string>* pDeviceVideo, std::list<std::string>* pDeviceAudio);
LIBMEDIACAPTURE_API int   MediaCapture_FindVideoDevice(const char* strExNameList);

LIBMEDIACAPTURE_API void* MediaCapture_Create();
LIBMEDIACAPTURE_API void  MediaCapture_Init(void* pCapHandle, MediaCaptureVideoInfo* pInfoVideo, MediaCaptureAudioInfo* pInfoAudio);
LIBMEDIACAPTURE_API void  MediaCapture_SetCB(void* pCapHandle, MediaCapture_CB pFuncVideo, MediaCapture_CB pFuncAudio, bool bRaw);
LIBMEDIACAPTURE_API void  MediaCapture_GetSPSAndPPS(void* pCapHandle, unsigned char*sps, long&spslen, unsigned char*pps, long&ppslen);
LIBMEDIACAPTURE_API void  MediaCapture_Release(void* pCapHandle);
LIBMEDIACAPTURE_API bool  MediaCapture_SetCameraExposure(void* pCapHandle, bool bAuto, int nVal); // HD [-13,-7,-1], normal [-10,-5, 1]

#endif // !_LIBMEDIACAPTURE_H_


